package com.ad.pet.ui;

import android.app.Dialog;
import android.content.Context;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.VideoView;

import com.ad.pet.R;

/**
 * Created by SEELE on 2019/7/5.
 */

public class SecondOpenRedbagDialog extends Dialog   {


    public SecondOpenRedbagDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);

        initView(context);
    }

    private void initView(Context context) {
        View view = View.inflate(context, R.layout.layout_open_red_too_much_dialog,null);

        VideoView imageViewClose =  view.findViewById(R.id.iv_movie);

        String uri = "android.resource://" + context.getPackageName() + "/" + R.raw.ic_re;
        imageViewClose.setVideoURI(Uri.parse(uri));
//        imageViewClose.setMediaController(new MediaController(context));
//        //请求焦点
//        imageViewClose.requestFocus();

        imageViewClose.start();




        setContentView(view);



        Window window = this.getWindow();
        WindowManager.LayoutParams lp = window.getAttributes();
//        lp.width = LyxUtils.dp2px(getContext(),250);
//        lp.height = LyxUtils.dp2px(getContext(),330);
        this.getWindow().setAttributes(lp);
        window.setGravity(Gravity.CENTER);
    }
}
